﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.platform.pojo.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>南京化工职业技术学院资源共享平台--个人中心</title>	
<link href="<%=basePath %>res/css/css.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" charset="utf-8" src="<%=basePath%>res/js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=basePath%>res/js/jquery.blockUI.js"></script>

<style> 
#login_box { width:280px;  display:none; padding-bottom:20px; position:relative; text-align:left; }
#teacher_box { width:280px;  display:none; padding-bottom:20px; position:relative; text-align:left; }
#student_box { width:280px;  display:none; padding-bottom:20px; position:relative; text-align:left; }
#login_box fieldset { border:0 none; }
#teacher_box fieldset { border:0 none; }
#student_box fieldset { border:0 none; }
.close { position:absolute; right:8px; top:0; display:block; width:33px; height:17px; background:url(images/close.png) no-repeat; text-indent:-9999px; outline:none; }
.top_h4 { font-size:16px; background:url(images/login_box_title_bg.png) repeat-x; line-height:36px; margin-bottom:20px; letter-spacing:1px; text-indent:23px; color:#232324; }
.label { padding-left:23px; }
.label p { font-size:13px; margin-bottom:10px; }
.label input { background:#f7f7f7; width:227px; height:20px; padding-top:2px; padding-left:3px; border:1px solid #caedbe; margin-bottom:20px; font:12px "Bitstream Vera Sans", "Trebuchet MS", Geneva, Verdana, Arial, Helvetica, sans-serif; }
.label input:hover, .label input:focus { border:1px solid #b2e06e; }
fieldset span a { text-align:center; margin-right:15px; font-size:12px; width:auto; line-height:24px; display:block; float:left; text-decoration:none; color:#63aa49; }
span a:hover { color:#000; }
.button2 a { width:65px; background:url(images/button2.gif) no-repeat; color:#232324; margin-left:23px !important; margin-left:11px; }
.button2 a:hover { text-decoration:none; background:#7e7e7d; color:#fff; }
#wrapper{ width:360px; padding:20px; margin:10% auto 0; background:#fff; border:1px solid #e0e0e0;}
h1,h3{ margin-bottom:10px; font-size:20px;}
h6{ font-weight:normal; font-size:12px; margin-bottom:20px; padding-bottom:10px; border-bottom:1px solid #e0e0e0;}
h6 a{  color:#505050; }
button{ margin-right:20px;}
#displayBox{ display:none;} 
#box{ width:600px; margin:0 auto; background:#fff; border:1px solid #ccc; padding:20px; display:none; -webkit-border-radius: 10px;-moz-border-radius: 10px; display:none; } 
#box p{ margin-bottom:20px;}
</style> 
<script type="text/javascript"> 
$(function(){ 
	if(${user.realName == null || user.realName == "" || user.email == null || user.email == ""}) {
		
		$("#realName").val($("#realName1").val());
		$("#email").val($("#email1").val());
    	$.blockUI({ message: $('#login_box') }); 
    }
	//$('.blockOverlay').attr('title','单击关闭').click($.unblockUI); 
	//$('.close').click($.unblockUI);
});
function doSubmit() {
	var realName = $("#realName").val();
	var email = $("#email").val();
	if(realName == null || $.trim(realName) == "") {
		alert("请填写真实姓名！");
		return ;
	}
	if(email == null || $.trim(email) == "") {
		alert("请填写邮箱！");
		return;
	}
	if(!/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/g.test($.trim(email))){
		alert("邮箱格式错误！");
		return ;
	}
	$.post("<%=basePath%>njcc/updateUserInfo.action",{"user.realName":$.trim(realName), "user.email":$.trim(email)},callback,"json")
}
function callback(data) {
	alert(data.msg);
	window.location.reload();
}
function apply(id) {
	if(id == 5) {
		//这里是和数据库中用户组的教师组对应的
		$.blockUI({ message: $('#teacher_box') }); 
		$('.blockOverlay').attr('title','单击关闭').click($.unblockUI); 
		$('.close').click($.unblockUI);
		//发送ajax请求
	} else if(id == 6) {
		//这里是和数据库中学生组ID对应
		$.blockUI({ message: $('#student_box') }); 
		$('.blockOverlay').attr('title','单击关闭').click($.unblockUI); 
		$('.close').click($.unblockUI);
		//发送ajax请求
	}
}
</script>
</head>
<body>
<input type="hidden" id="realName1" value="${user.realName }" />
<input type="hidden" id="email1" value="${user.email }" />
<div id="login_box"> 
  <fieldset>
	    <h4 class="top_h4">完善资料</h4>  
	    <div class="label"> 
	      <p>真实姓名</p> 
	      <input id="realName" name="realName" type="text" /> 
	    </div> 
	    <div class="label"> 
	      <p>邮箱</p> 
	      <input id="email" name="email" type="text"/> 
	    </div> 
	    <span class="button2"><a href="javascript:doSubmit();">提交</a></span><span><a href="#"></a></span>
  </fieldset> 
</div>
<div id="teacher_box"> 
  <fieldset> 
    <h4 class="top_h4">请完善相关信息</h4> 
    <a href="#" class="close" title="关闭">close</a> 
    <div class="label"> 
      <p>您所在的系别/部门</p> 
		<select id="departmentName" name="user.departmentId" style="width:180px;" onchange="javascript:loadChilds(this.value, 'professionalName');">
			<c:if test="${empty departmentlist}">
			     <option value="0" <c:if test="${department.id == 0 }" >selected="selected"</c:if>>请选择</option>
			</c:if>
			<c:if test="${!empty departmentlist}">
			     <c:forEach items="${departmentlist}" var="obj">
			         <option value="${obj.id }" <c:if test="${department.id == obj.id }" >selected="selected"</c:if>>${obj.name }</option>
			     </c:forEach>
			</c:if>
		</select>
    </div> 
    <div class="label"> 
      <p>您所在的考研室/专业</p> 
      <input id="password" name="password" type="password"/> 
    </div> 
    <span class="button2"><a href="#">提交</a></span> 
  </fieldset> 
</div>
<div id="student_box"> 
  <fieldset> 
    <h4 class="top_h4">请完善相关信息</h4> 
    <a href="#" class="close" title="关闭">close</a> 
    <div class="label"> 
      <p>系别</p> 
      <input id="username" name="username" type="text" /> 
    </div> 
    <div class="label"> 
      <p>专业</p> 
      <input id="password" name="password" type="password"/> 
    </div>
    <div class="label"> 
      <p>年级</p> 
      <input id="password" name="password" type="password"/> 
    </div>
    <div class="label"> 
      <p>班级</p> 
      <input id="password" name="password" type="password"/> 
    </div> 
    <span class="button2"><a href="#">提交</a></span> 
  </fieldset> 
</div> 
<div id="header">
   <div id="top">
		<ul>
		  <li><marquee onmouseover=this.stop() onmouseout=this.start()>今日访问：${accessCount }&nbsp;&nbsp;共享资源总数：${resCount }&nbsp;&nbsp;注册用户总数：${userCount }&nbsp;&nbsp;资源共享达人：${daUser.realName }&nbsp;&nbsp;资源下载热度：${faRes.name }</marquee></li>
		</ul>
   </div>
   <div id="bottom">
       <div id="bleft"><img src="<%=basePath%>res/images/share_05.jpg" width="387" height="65" />
       </div>
       <div id="bright">
            <ul>
            	<c:if test="${empty user}">
                 <li><a href="javascript:window.location.href='<%=basePath%>login.jsp?refreshurl=entry.jsp';"><img src="<%=basePath%>res/images/share_08.jpg" width="31" height="18" /></a>&nbsp;&nbsp;
                 	<a href="javascript:window.location.href='<%=basePath%>register.jsp?refreshurl=entry.jsp';"><img src="<%=basePath%>res/images/share_1.jpg" width="31" height="18" /></a>&nbsp;&nbsp;
                 	<a href="javascript:window.location.href='<%=basePath%>retrieve.jsp';">忘记密码？</a>
                 </li>
                 </c:if>
            	<c:if test="${!empty user}">
                 <li>
                 	<h2>${user.realName }，欢迎回来！</h2><h2><a href="<%=basePath%>njcc/loadUserInfo.action" style="color:red;">个人中心，</a></h2>&nbsp;&nbsp;<h2><a href="<%=basePath%>njcc/logout.action">点击退出！</a></h2>
                 </li>
                 </c:if>
            </ul>
       </div>
   </div>
</div>
<div id="content">
     <div id="cleft">
          <div id="dh1"></div>
                <div id="dhc1">
                    <ul>
                        <li><a href="<%=basePath%>njcc/loadUserInfo.action">个人信息</a></li>
                        <li><a href="javascript:window.location.href='<%=basePath%>resetpasswd.jsp'">修改密码</a></li>
                        <li><a href="javascript:window.location.href='<%=basePath%>editinfo.jsp'">编辑个人信息</a></li>
                        <li><a href="<%=basePath%>njcc/loadCustomResList.action?type=myupload">我上传的资源</a></li>
                        <li><a href="<%=basePath%>njcc/loadCustomResList.action?type=mydownload">我下载的资源</a></li>
                        <!-- <li><a href="#">我的课程</a></li> -->
                  </ul>
                </div>
                <img src="<%=basePath%>res/images/left_08.jpg" width="192" height="16" />
          </div>
  <div id="cright">
                
                	<div id="location"><a class="blue" href="<%=basePath%>entry.jsp">首页</a>
				                		<span class="blue"> >> </span>个人中心
				    </div>

         <!--正文开始 -->
			 <div class="all-yonghu">
                    <div class="yonghu" style="padding:10px;width:100%;">
                    		<table style="width:100%;">
	                    		<tr>
	                    			<td style="width:120px;">帐号：</td>
	                    			<td>${user.loginName }</td>
	                    			<td style="width:120px;">真实姓名：</td>
	                    			<td>${user.realName }</td>
	                    		</tr>
	                    		<tr>
	                    			<td style="width:120px;">邮箱：</td>
	                    			<td>${user.email }</td>
	                    			<td style="width:120px;">手机号：</td>
	                    			<td>${user.mobile }</td>
	                    		</tr>
	                    		<tr>
	                    			<td style="width:120px;">积分：</td>
	                    			<td>${user.score }</td>
	                    			<td style="width:120px;">注册时间：</td>
	                    			<td>${regTime }</td>
	                    		</tr>
	                    		<tr>
	                    			<c:if test="${user.groupId != 0}">
		                    			<td style="width:120px;">用户组：</td>
		                    			<td>${group.groupName }</td>
	                    			</c:if>
	                    			<td style="width:120px;">最近登陆时间：</td>
	                    			<td>${lastLoginTime }</td>
	                    		</tr>
	                    		<c:if test="${user.groupId != 0}">
		                    		<tr>
		                    			<td style="width:120px;">系部：</td>
		                    			<td>${department.name }</td>
		                    			<td style="width:120px;">专业：</td>
		                    			<td>${professional.name }</td>
		                    		</tr>
		                    		<tr>
		                    			<td style="width:120px;">年级：</td>
		                    			<td>${grade.name }</td>
		                    			<td style="width:120px;">班级：</td>
		                    			<td>${clazz.name }</td>
		                    		</tr>
	                    		</c:if>
	                    		<tr>
	                    			<td style="width:120px;">您帐号当前状态：</td>
	                    			<td colspan="3">
	                    				<c:if test="${user.isAudit == 0}">
	                    					<a style="color:red;">待审核</a>
	                    				</c:if>
	                    				<c:if test="${user.isAudit == 1}">
	                    					<a style="color:green;">已审核通过</a>
	                    				</c:if>
	                    				<c:if test="${user.isAudit == 2}">
	                    					<a style="color:orange;">未通过审核</a>
	                    				</c:if>
	                    			</td>
	                    		</tr>
	                    		<!-- 
	                    		<c:if test="${!empty groups && user.isAudit == 1 && user.groupId != 0}">
		                    		<tr>
		                    			<td style="width:120px;">您还可以：</td>
		                    			<td colspan="3">
		                    				<c:forEach items="${groups}" var="obj">
		                    					<c:if test="${obj.id != group.id}">
		                    						<a href="javascript:apply(${obj.id });">申请成为${obj.groupName }用户</a>&nbsp;&nbsp;
		                    					</c:if>
		                    				</c:forEach>
		                    			</td>
		                    		</tr>
	                    		</c:if>
	                    		 -->
	                    		<!-- 
	                    		<tr style="text-align: center;">
	                    			<td><input style="border: #bbb 1px solid;" type="submit" name="submit" id="submit" value="修改密码" /></td>
	                    			<td><input style="border: #bbb 1px solid;" type="reset" name="reset" id="reset" value="取消" /></td>
	                    		</tr>
	                    		 -->
	                    	</table>
                    </div>   
         <!--正文结束 -->
	</div>
  </div>
</div>
<div id="guanggao1">
<img src="<%=basePath%>res/images/share_44.jpg" width="900" height="95" /></div>
<div id="banquan">
           <ul>
                 <li>南京化工职业技术学院--资源共享网 <img src="<%=basePath%>res/images/pic.gif" width="50" height="12" /></li>           
                 <li>诚聘英才 | 友情链接 | 联系我们</li> 
                 <li>版权所有©南京化工职业技术学院 ICP：沪B2-20030192 </li>
  </ul>
</div>
</body>
</html>
